//
//  MOWaitDoDetail_MainViewCell.m
//  MobileOffice
//
//  Created by 冰冰 on 2019/6/7.
//  Copyright © 2019 com.idolmedia. All rights reserved.
//

#import "MOWaitDoDetail_MainViewCell.h"

@interface MOWaitDoDetail_MainViewCell ()

@property(nonatomic,strong)UIImageView *iconImage;

@end

@implementation MOWaitDoDetail_MainViewCell

+(instancetype)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath
{
    //NSString *ID = [NSString stringWithFormat:@"Cell%ld%ld",(long)[indexPath section],(long)[indexPath row]];
    NSString *ID = @"MOWaitDoDetail_MainViewCell";
    MOWaitDoDetail_MainViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil){
        cell = [[MOWaitDoDetail_MainViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        [cell creatView];
    }
    return cell;
}


-(void)creatView
{
    self.iconImage = [[UIImageView alloc]initWithFrame:CGRectMake(25, 0, 18, 16)];
    self.iconImage.image = IMAGE(@"fujian");
    [self addSubview:self.iconImage];
    
    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.iconImage.right + 5, kHConversions(19), SCREEN_WIDTH - 50 - 23, 16)];
    self.nameLabel.textColor = KBlackColor_2A2A2A;
    self.nameLabel.font = FONT_SIZE(15);
    self.nameLabel.numberOfLines = 0;
    [self addSubview:self.nameLabel];
}

-(void)setModel:(MOWaitDoDetail_MainModel *)model
{
    self.nameLabel.text = model.alias;
    CGFloat height = [NSString labelAutoCalculateRectWith:model.alias WithFont:FONT_SIZE(15) MaxSize:CGSizeMake(self.nameLabel.width, MAXFLOAT)].height;
    if (height<16) {
        height = 16;
    }
    self.nameLabel.height = height;
    
    self.iconImage.centerY = self.nameLabel.centerY;
}

+ (CGFloat)heightForMOWaitDoDetail_MainViewCellAndModel:(MOWaitDoDetail_MainModel *)model
{
    CGFloat height = [NSString labelAutoCalculateRectWith:model.alias WithFont:FONT_SIZE(15) MaxSize:CGSizeMake(SCREEN_WIDTH - 50 - 23, MAXFLOAT)].height;
    if (height<16) {
        height = 16;
    }
    return kHConversions(19) * 2 + height;
}



@end
